Next: Window Internals, Up: Object Internals [Contents][Index]
Two structures (see buffer.h) are used to
represent buffers in C. The buffer_text structure
contains fields describing the text of a buffer; the
buffer structure holds other fields. In the case of
indirect buffers, two or more buffer structures
reference the same buffer_text structure.
Here are some of the fields in struct
buffer_text:
begThe address of the buffer contents.
gptgpt_byteThe character and byte positions of the buffer gap. See Buffer Gap.
zz_byteThe character and byte positions of the end of the buffer text.
gap_sizeThe size of buffer’s gap. See Buffer Gap.
modiffsave_modiffchars_modiffoverlay_modiffThese fields count the number of buffer-modification
events performed in this buffer. modiff is
incremented after each buffer-modification event, and is
never otherwise changed; save_modiff contains
the value of modiff the last time the buffer was
visited or saved; chars_modiff counts only
modifications to the characters in the buffer, ignoring all
other kinds of changes; and overlay_modiff
counts only modifications to the overlays.
beg_unchangedend_unchangedThe number of characters at the start and end of the text that are known to be unchanged since the last complete redisplay.
unchanged_modifiedoverlay_unchanged_modifiedThe values of modiff and
overlay_modiff, respectively, after the last
complete redisplay. If their current values match
modiff or overlay_modiff, that
means beg_unchanged and
end_unchanged contain no useful information.
markersThe markers that refer to this buffer. This is actually a
single marker, and successive elements in its marker
chain are the other markers referring to this
buffer text.
intervalsThe interval tree which records the text properties of this buffer.
Some of the fields of struct buffer are:
headerA header of type struct vectorlike_header is
common to all vectorlike objects.
own_textA struct buffer_text structure that
ordinarily holds the buffer contents. In indirect buffers,
this field is not used.
textA pointer to the buffer_text structure for
this buffer. In an ordinary buffer, this is the
own_text field above. In an indirect buffer,
this is the own_text field of the base
buffer.
nextA pointer to the next buffer, in the chain of all buffers, including killed buffers. This chain is used only for allocation and garbage collection, in order to collect killed buffers properly.
ptpt_byteThe character and byte positions of point in a buffer.
begvbegv_byteThe character and byte positions of the beginning of the accessible range of text in the buffer.
zvzv_byteThe character and byte positions of the end of the accessible range of text in the buffer.
base_bufferIn an indirect buffer, this points to the base buffer. In an ordinary buffer, it is null.
local_flagsThis field contains flags indicating that certain
variables are local in this buffer. Such variables are
declared in the C code using DEFVAR_PER_BUFFER,
and their buffer-local bindings are stored in fields in the
buffer structure itself. (Some of these fields are described
in this table.)
modtimeThe modification time of the visited file. It is set when the file is written or read. Before writing the buffer into a file, this field is compared to the modification time of the file to see if the file has changed on disk. See Buffer Modification.
auto_save_modifiedThe time when the buffer was last auto-saved.
last_window_startThe window-start position in the buffer as of
the last time the buffer was displayed in a window.
clip_changedThis flag indicates that narrowing has changed in the buffer. See Narrowing.
prevent_redisplay_optimizations_pThis flag indicates that redisplay optimizations should not be used to display this buffer.
overlay_centerThis field holds the current overlay center position. See Managing Overlays.
overlays_beforeoverlays_afterThese fields hold, respectively, a list of overlays that
end at or before the current overlay center, and a list of
overlays that end after the current overlay center. See
Managing
Overlays. overlays_before is sorted in order
of decreasing end position, and overlays_after
is sorted in order of increasing beginning position.
nameA Lisp string that names the buffer. It is guaranteed to be unique. See Buffer Names.
save_lengthThe length of the file this buffer is visiting, when last
read or saved. This and other fields concerned with saving
are not kept in the buffer_text structure
because indirect buffers are never saved.
directoryThe directory for expanding relative file names. This is
the value of the buffer-local variable
default-directory (see File Name
Expansion).
filenameThe name of the file visited in this buffer, or
nil. This is the value of the buffer-local
variable buffer-file-name (see Buffer File
Name).
undo_listbacked_upauto_save_file_nameauto_save_file_formatread_onlyfile_formatfile_truenameinvisibility_specdisplay_countdisplay_timeThese fields store the values of Lisp variables that are
automatically buffer-local (see Buffer-Local
Variables), whose corresponding variable names have the
additional prefix buffer- and have underscores
replaced with dashes. For instance, undo_list
stores the value of buffer-undo-list.
markThe mark for the buffer. The mark is a marker, hence it is
also included on the list markers. See The Mark.
local_var_alistThe association list describing the buffer-local variable bindings of this buffer, not including the built-in buffer-local bindings that have special slots in the buffer object. (Those slots are omitted from this table.) See Buffer-Local Variables.
major_modeSymbol naming the major mode of this buffer, e.g.,
lisp-mode.
mode_namePretty name of the major mode, e.g.,
"Lisp".
keymapabbrev_tablesyntax_tablecategory_tabledisplay_tableThese fields store the buffer’s local keymap (see Keymaps), abbrev table (see Abbrev Tables), syntax table (see Syntax Tables), category table (see Categories), and display table (see Display Tables).
downcase_tableupcase_tablecase_canon_tableThese fields store the conversion tables for converting text to lower case, upper case, and for canonicalizing text for case-fold search. See Case Tables.
minor_modesAn alist of the minor modes of this buffer.
pt_markerbegv_markerzv_markerThese fields are only used in an indirect buffer, or in a
buffer that is the base of an indirect buffer. Each holds a
marker that records pt, begv, and
zv respectively, for this buffer when the buffer
is not current.
mode_line_formatheader_line_formatcase_fold_searchtab_widthfill_columnleft_marginauto_fill_functiontruncate_linesword_wrapctl_arrowbidi_display_reorderingbidi_paragraph_directionselective_displayselective_display_ellipsesoverwrite_modeabbrev_modemark_activeenable_multibyte_charactersbuffer_file_coding_systemcache_long_line_scanspoint_before_scrollleft_fringe_widthright_fringe_widthfringes_outside_marginsscroll_bar_widthindicate_empty_linesindicate_buffer_boundariesfringe_indicator_alistfringe_cursor_alistscroll_up_aggressivelyscroll_down_aggressivelycursor_typecursor_in_non_selected_windowsThese fields store the values of Lisp variables that are
automatically buffer-local (see Buffer-Local
Variables), whose corresponding variable names have
underscores replaced with dashes. For instance,
mode_line_format stores the value of
mode-line-format.
last_selected_windowThis is the last window that was selected with this buffer
in it, or nil if that window no longer displays
this buffer.
Next: Window Internals, Up: Object Internals [Contents][Index]